#include<iostream>
#include<list>
using namespace std;

struct dict{
	string key;
	string value;
};

list<dict> database;

bool insert(string key, string value);
string select(string key);
void printAll();
bool deleteValue(string key);
void deleteAll();

int main(){
	int t;
	string key, value;
	while(true){
		cin>>t;
		if(t == 0){
			cin>>key;
			cin>>value;
			if(insert(key, value)) cout<<"insert succeed"<<endl;
			else cout<<"insert failed"<<endl;
		}else if(t == 1){
			cin>>key;
			cout<<select(key)<<endl;
		}else if(t == 2){
			printAll();
		}else if(t == 3){
			cin>>key;
			if(deleteValue(key)) cout<<"delete succeed"<<endl;
			else cout<<"delete failed"<<endl;
		}else if(t == 4){
			deleteAll();
		}else break;
	}
	return 0;
}

bool insert(string key, string value){
	dict newNode = {key, value};
	for(dict i:database){
		if(i.key == key) return false;
	}
	database.push_back(newNode);
	return true;
}
string select(string key){
	for(dict i:database){
		if(i.key == key) return i.value;
	}
	return "select failed";
}
void printAll(){
	bool flag = false;
	for(dict i:database){
		flag = true;
		cout<<i.key<<" "<<i.value<<endl;
	}
	if(!flag) cout<<"empty"<<endl;
}
bool deleteValue(string key){
	for(std::list<dict>::iterator it = database.begin(); it != database.end(); it++){
		if((*it).key == key){
			database.erase(it);
			return true;
		}
	}
	return false;
}
void deleteAll(){
	cout<<"delete succeed"<<endl;
	database.clear();
}
